﻿var chartVue = new Vue({
	el: "body",
	data: {
		selectYear: "",
		selectMonth: "",
		dataRange: "", //年趋势数据
		chartTab: "",
		lastYear: "",
		huanBiData: "", //环比数据
		index: "" //监听的值
	},
	//监听函数 用来判断ajax是否完成 同时消除loading
	watch: {
		'index': function(val, oldVal) {
			if(val == 5 && $(".statistics-chart-tab .active").html() == "工程档案") {
				$(".loader").addClass("hidden")
				$(".project").removeClass("hidden")
			};
			if(val == 3 && $(".statistics-chart-tab .active").html() == "测绘") {
				$(".loader").addClass("hidden")
				$(".map").removeClass("hidden")
			};
			if(val == 3 && $(".statistics-chart-tab .active").html() == "地下管线") {
				$(".loader").addClass("hidden")
				$(".line").removeClass("hidden")
			};
			if(val == 3 && $(".statistics-chart-tab .active").html() == "档案查询") {
				$(".loader").addClass("hidden")
				$(".search").removeClass("hidden")
			};
			if(val == 3 && $(".statistics-chart-tab .active").html() == "档案数量") {
				$(".loader").addClass("hidden")
				$(".file").removeClass("hidden")
			};
			if(val == 3 && $(".statistics-chart-tab .active").html() == "馆内公文") {
				$(".loader").addClass("hidden")
				$(".book").removeClass("hidden")
			};
		}
	},
	methods: {
		projectChart: function() {
			//工程档案出图\
			$(".loader").removeClass("hidden")
			$(".project").addClass("hidden")
			_this.index = 0;
			_this.chartTab = 1;
			loadHuanBi(_this, "projectHuanBiChart", "getProjectArcLinkChart ")
			loadTongBi(_this, "yuDengJiChart", "预登记", "getProjectArcYearCompare")
			loadTongBi(_this, "yuYanShouChart", "预验收", "getProjectArcYearCompare")
			loadTongBi(_this, "yanShouChart", "验收", "getProjectArcYearCompare")
			loadTongBi(_this, "zhuanTiChart", "专题片", "getProjectArcYearCompare")
		},
		backTotal: function() {
			$("#yearDate").val("");
			$("#dateDate").val("");
			$(".statistics-chart-selectPage").animate({ "right": -600 }, 250);
		},
		searchCycle: function() {
			var selectYear = $("#yearDate").val();
			var selectMonth = $("#dateDate").val();
			if(selectYear.length > 0 && selectMonth.length > 0) {
				location.href = "statisticsChartNew.html?selectYear=" + parseInt(selectYear) + "&selectMonth=" + parseInt(selectMonth)
			} else {
				$.toast("请输入完整周期", "cancel", function(toast) {});
			}
		},
		mapChart: function() {
			$(".loader").removeClass("hidden")
			$(".map").addClass("hidden")

			//测绘业务出图
			_this.index = 0;
			_this.chartTab = 2
			loadHuanBi(_this, "mapHuanBiChart", "getTONGJI_CHANZHI_LinkChart")
			loadTongBi(_this, "heTongChart", "签订合同", "getTONGJI_CHANZHI_YearCompare")
			loadTongBi(_this, "chengGuoChart", "交付成果", "getTONGJI_CHANZHI_YearCompare")
		},
		lineChart: function() {
			$(".loader").removeClass("hidden")
			$(".line").addClass("hidden")
			//地下管线出图
			_this.index = 0;
			$(".loader").removeClass("hidden")
			_this.chartTab = 3
			loadHuanBi(_this, "lineHuanBiChart", "getTONGJI_GUANXIAN_LinkChart")
			loadTongBi(_this, "ruKuChart", "入库", "getTONGJI_GUANXIANI_YearCompare")
			loadTongBi(_this, "chaXunChart", "查询", "getTONGJI_GUANXIANI_YearCompare")

		},
		searchChart: function() {
			$(".loader").removeClass("hidden")
			$(".search").addClass("hidden")

			_this.index = 0;
			_this.chartTab = 4
			loadHuanBi(_this, "searchHuanBiChart", "getTONGJI_FILEQUERY_LinkChart")
			loadTongBi(_this, "juNeiChart", "局内", "getTONGJI_FILEQUERY_YearCompare")
			loadTongBi(_this, "juWaiChart", "局外", "getTONGJI_FILEQUERY_YearCompare")
		},
		fileNumChart: function() {
			$(".loader").removeClass("hidden")
			$(".file").addClass("hidden")

			_this.index = 0;
			_this.chartTab = 5
			loadHuanBi(_this, "fileHuanBiChart", "getTONGJI_FILERECEIVE_LinkChart")
			loadTongBi(_this, "jieShouChart", "接收", "getTONGJI_FILERECEIVE_YearCompare")
			loadTongBi(_this, "ruKu2Chart", "入库", "getTONGJI_FILERECEIVE_YearCompare")
		},
		bookChart: function() {
			$(".loader").removeClass("hidden")
			$(".book").addClass("hidden")

			_this.index = 0;
			_this.chartTab = 6
			loadHuanBi(_this, "bookHuanBiChart", "getTONGJI_WENSHU_LinkChart")
			loadTongBi(_this, "shouWenChart", "收文", "getTONGJI_WENSHU_YearCompare")
			loadTongBi(_this, "faWenChart", "发文", "getTONGJI_WENSHU_YearCompare")
		}

	},
	created: function() {
		_this = this;
		if(getUrlItem("selectYear") == "") {
			var time = new Date();
			_this.selectYear = time.getFullYear()
			_this.lastYear = _this.selectYear - 1
			_this.selectMonth = time.getMonth() + 1
		} else {
			_this.selectYear = getUrlItem("selectYear")
			_this.selectMonth = getUrlItem("selectMonth")
			_this.lastYear = _this.selectYear - 1
		}
		var base64 = new Base64(); //声明base解码和编码类
		_this.dataRange = base64.encode(setDataRange(_this.selectYear, _this.selectMonth)); //算出并base64编码折线图传递的数据
		_this.huanBiData = setChartData(_this.selectYear, _this.selectMonth)

		_this.$nextTick(function() {
			setTimeout(function() {
				$(".statistics-chart-body").removeClass("hidden")
			}, 200)
		})
	},
	ready: function() {
		$(function() {
			$(".statistics-chart-tab>div").eq(0).click()
		})

		$(function() {
			FastClick.attach(document.body);
		});
		// 禁止遮罩层的滑动事件
		$('.statistics-chart-selectPage').bind("touchmove", function(e) {
			e.preventDefault();
		});

		//给遮罩层设置宽高
		var WindowHeight = $(window).height();
		var WindowWidth = $(window).width();
		$(".statistics-chart-selectPage").css("height", WindowHeight);
		$(".statistics-chart-selectPage").css("width", WindowWidth);

		//点击弹出遮罩层
		$(".selectBtn").click(function() {
			$(".statistics-chart-selectPage").show();
			$(".statistics-chart-selectPage").animate({ "right": 0 }, 250);
		})

		//图标类型切换
		$(".statistics-chart-tab>div").click(function() {
			$(".statistics-chart-tab>div").removeClass("active")
			$(this).addClass("active")
		})

		$("#yearDate").picker({
			title: "请选择查询年份",
			cols: [{
				textAlign: 'center',
				values: ['2016年', '2017年', '2018年', '2019年', '2020年', '2021年', '2022年', '2023年', '2024年', '2025年']
			}]
		});

		$("#dateDate").picker({
			title: "请选择查询月份",
			cols: [{
				textAlign: 'center',
				values: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
			}]
		});

	}
})

//分项趋势传参格式化
function setDataRange(nowYear, nowMonth) {
	var dataArray = { "lastYear": [], "nowYear": [] } //传递给后端的参数 分为当前年统计范围和上一年统计范围
	var itemNowYear = nowYear //当前统计年
	var itemLastYear = nowYear - 1 //上一个统计年

	for(var i = 0; i < nowMonth; i++) {
		//从当前月到这一年的第一个月
		var itemNowMonth_first = new Date(itemNowYear + "/" + (i + 1) + "/1 00:00:00") //得到当前年每个月第一天时间对象
		var itemLastMonth_first = new Date(itemLastYear + "/" + (i + 1) + "/1 00:00:00") //得到上一个月第一天时间对象

		var itemNowMonth_last = new Date(itemNowYear + "/" + (i + 1) + "/" + getMonthDays(itemNowYear, i) + " 00:00:00") //得到当前年每个月最后一天的时间对象
		var itemLastMonth_last = new Date(itemLastYear + "/" + (i + 1) + "/" + getMonthDays(itemLastYear, i) + " 00:00:00") //得到上一年每个月最后一天的时间对象

		//当前年每个月开始周的周五
		var itemNowMonth_firstFriday = getFirstAndLastDay(itemNowMonth_first, "line").friday + " 23:59:59" //当前每个月第一天所在周的周五（最后时间）
		var itemNowMonth_firstFridayObj = new Date(itemNowMonth_firstFriday)

		//当前年每个月结束周的周五
		var itemNowMonth_lastFriday = getFirstAndLastDay(itemNowMonth_last, "line").friday + " 00:00:00" //（开始时间）
		var itemNowMonth_lastFridayObj = new Date(itemNowMonth_lastFriday)

		//上一年每个月开始周的周五
		var itemLastMonth_firstFriday = getFirstAndLastDay(itemLastMonth_first, "line").friday + " 23:59:59" //（最后时间）
		var itemLastMonth_firstFridayObj = new Date(itemLastMonth_firstFriday)

		//上一年每个月结束周的周五
		var itemLastMonth_lastFriday = getFirstAndLastDay(itemLastMonth_last, "line").friday + " 00:00:00" //（开始时间）
		var itemLastMonth_lastFridayObj = new Date(itemLastMonth_lastFriday)

		//当前统计年操作
		//只要一个月的开始所在周不是周六周日，那么开始的这周的数据是要统计的
		if(itemNowMonth_first <= itemNowMonth_firstFridayObj) {
			var fridayYear = itemNowMonth_firstFridayObj.getFullYear();
			var fridayMonth = itemNowMonth_firstFridayObj.getMonth() + 1;
			var fridayDate = itemNowMonth_firstFridayObj.getDate();
			var itemNowMonth_start = getWeekNumber(fridayYear, fridayMonth, fridayDate);
		} else {
			var oneDayLong = 24 * 60 * 60 * 1000;
			var nextFriday = new Date(itemNowMonth_firstFridayObj.getTime() + 7 * oneDayLong);
			var nextFridayYear = nextFriday.getFullYear();
			var nextFridayMonth = nextFriday.getMonth() + 1;
			var nextFridayDate = nextFriday.getDate();
			var itemNowMonth_start = getWeekNumber(nextFridayYear, nextFridayMonth, nextFridayDate);
		}

		//只要一个月的结束所在周是周一到周四 那么结束的这周是不统计的
		if(itemNowMonth_last < itemNowMonth_lastFridayObj) {
			var oneDayLong = 24 * 60 * 60 * 1000;
			var lastFriday = new Date(itemNowMonth_lastFridayObj.getTime() - 7 * oneDayLong);
			var lastFridayYear = lastFriday.getFullYear();
			var lastFridayMonth = lastFriday.getMonth() + 1;
			var lastFridayDate = lastFriday.getDate();
			var itemNowMonth_end = getWeekNumber(lastFridayYear, lastFridayMonth, lastFridayDate);
		} else {
			var fridayYear = itemNowMonth_lastFridayObj.getFullYear();
			var fridayMonth = itemNowMonth_lastFridayObj.getMonth() + 1;
			var fridayDate = itemNowMonth_lastFridayObj.getDate();
			var itemNowMonth_end = getWeekNumber(fridayYear, fridayMonth, fridayDate);
		}

		//上一个统计年操作
		//只要一个月的开始所在周不是周六周日，那么开始的这周的数据是要统计的
		if(itemLastMonth_first < itemLastMonth_firstFridayObj) {
			var fridayYear = itemLastMonth_firstFridayObj.getFullYear();
			var fridayMonth = itemLastMonth_firstFridayObj.getMonth() + 1;
			var fridayDate = itemLastMonth_firstFridayObj.getDate();
			var itemLastMonth_start = getWeekNumber(fridayYear, fridayMonth, fridayDate);
		} else {
			var oneDayLong = 24 * 60 * 60 * 1000;
			var nextFriday = new Date(itemLastMonth_firstFridayObj.getTime() + 7 * oneDayLong);
			var nextFridayYear = nextFriday.getFullYear();
			var nextFridayMonth = nextFriday.getMonth() + 1;
			var nextFridayDate = nextFriday.getDate();
			var itemLastMonth_start = getWeekNumber(nextFridayYear, nextFridayMonth, nextFridayDate);
		}

		//只要一个月的结束所在周是周一到周四 那么结束的这周是不统计的
		if(itemLastMonth_last < itemLastMonth_lastFridayObj) {
			var oneDayLong = 24 * 60 * 60 * 1000;
			var lastFriday = new Date(itemLastMonth_lastFridayObj.getTime() - 7 * oneDayLong);
			var lastFridayYear = lastFriday.getFullYear();
			var lastFridayMonth = lastFriday.getMonth() + 1;
			var lastFridayDate = lastFriday.getDate();
			var itemLastMonth_end = getWeekNumber(lastFridayYear, lastFridayMonth, lastFridayDate);
		} else {
			var fridayYear = itemLastMonth_lastFridayObj.getFullYear();
			var fridayMonth = itemLastMonth_lastFridayObj.getMonth() + 1;
			var fridayDate = itemLastMonth_lastFridayObj.getDate();
			var itemLastMonth_end = getWeekNumber(fridayYear, fridayMonth, fridayDate);
		}

		dataArray.nowYear.push({
			"year": itemNowYear,
			"month": i + 1,
			"start": itemNowMonth_start,
			"end": itemNowMonth_end
		})
		dataArray.lastYear.push({
			"year": itemLastYear,
			"month": i + 1,
			"start": itemLastMonth_start,
			"end": itemLastMonth_end
		})
	}
	return JSON.stringify(dataArray)
}

//柱形图传递数据格式化
function setChartData(nowYear, nowMonth) {
	var nowMonth_first = new Date(nowYear + "/" + nowMonth + "/1 00:00:00") //得到当前年当前月第一天时间对象
	var nowMonth_last = new Date(nowYear + "/" + nowMonth + "/" + getMonthDays(nowYear, nowMonth - 1) + " 00:00:00") //得到当前年当前月最后一天的时间对象

	//计算的出上个月的年，月
	var lastYear = nowMonth - 1 > 0 ? nowYear : nowYear - 1
	var lastMonth = nowMonth - 1 > 0 ? nowMonth - 1 : nowMonth + 12 - 1

	var lastMonth_first = new Date(lastYear + "/" + lastMonth + "/1 00:00:00") //得到当前年上个月第一天时间对象
	var lastMonth_last = new Date(lastYear + "/" + lastMonth + "/" + getMonthDays(lastYear, lastMonth - 1) + " 00:00:00") //得到当前年上个月最后一天的时间对象

	var nowMonth_firstFriday = new Date(getFirstAndLastDay(nowMonth_first, "line").friday + " 23:59:59"); //当前月所在周第一个周五
	var lastMonth_firstFriday = new Date(getFirstAndLastDay(lastMonth_first, "line").friday + " 23:59:59"); //上个月所在周第一个周五

	var nowMonth_lastFriday = new Date(getFirstAndLastDay(nowMonth_last, "line").friday + " 00:00:00"); //当前月所在周最后一个周五
	var lastMonth_lastFriday = new Date(getFirstAndLastDay(lastMonth_last, "line").friday + " 00:00:00"); //上个月所在周最后一个周五

	//判断当前年当前月和当前年上一个月所在开始年 开始月 结束年 结束月8个参数
	//只要这个月开始的时间不是周六周日这周就要统计到这个月内
	if(nowMonth_first < nowMonth_firstFriday) {
		var fridayYear = nowMonth_firstFriday.getFullYear()
		var fridayMonth = nowMonth_firstFriday.getMonth() + 1
		var fridayDate = nowMonth_firstFriday.getDate()
		var nowMonth_begin = getWeekNumber(fridayYear, fridayMonth, fridayDate)
	} else {
		var oneDayLong = 24 * 60 * 60 * 1000;
		var nextFriday = new Date(nowMonth_firstFriday.getTime() + 7 * oneDayLong)
		var nextFridayYear = nextFriday.getFullYear();
		var nextFridayMonth = nextFriday.getMonth() + 1;
		var nextFridayDate = nextFriday.getDate();
		var nowMonth_begin = getWeekNumber(nextFridayYear, nextFridayMonth, nextFridayDate)
	}

	//只要上个月开始的时间不是周六周日，这周就要统计到上个月
	if(lastMonth_first < lastMonth_firstFriday) {
		var fridayYear = lastMonth_first.getFullYear()
		var fridayMonth = lastMonth_first.getMonth() + 1
		var fridayDate = lastMonth_first.getDate()
		var lastMonth_begin = getWeekNumber(fridayYear, fridayMonth, fridayDate)
	} else {
		var oneDayLong = 24 * 60 * 60 * 1000;
		var nextFriday = new Date(lastMonth_firstFriday.getTime() + 7 * oneDayLong)
		var nextFridayYear = nextFriday.getFullYear();
		var nextFridayMonth = nextFriday.getMonth() + 1;
		var nextFridayDate = nextFriday.getDate();
		var lastMonth_begin = getWeekNumber(nextFridayYear, nextFridayMonth, nextFridayDate)
	}

	//只要当前月结束的事件是周一到周四那么这周数据就不统计到当前周
	if(nowMonth_last < nowMonth_lastFriday) {
		var oneDayLong = 24 * 60 * 60 * 1000;
		var lastFriday = new Date(nowMonth_lastFriday.getTime() - 7 * oneDayLong)
		var lastFridayYear = lastFriday.getFullYear();
		var lastFridayMonth = lastFriday.getMonth() + 1;
		var lastFridayDate = lastFriday.getDate();
		var nowMonth_end = getWeekNumber(lastFridayYear, lastFridayMonth, lastFridayDate)
	} else {
		var fridayYear = nowMonth_lastFriday.getFullYear()
		var fridayMonth = nowMonth_lastFriday.getMonth() + 1
		var fridayDate = nowMonth_lastFriday.getDate()
		var nowMonth_end = getWeekNumber(fridayYear, fridayMonth, fridayDate)
	}

	//只要上个月结束的事件是周一到周四那么这周数据就不统计到当前周
	if(lastMonth_last < lastMonth_lastFriday) {
		var oneDayLong = 24 * 60 * 60 * 1000;
		var lastFriday = new Date(lastMonth_lastFriday.getTime() - 7 * oneDayLong)
		var lastFridayYear = lastFriday.getFullYear();
		var lastFridayMonth = lastFriday.getMonth() + 1;
		var lastFridayDate = lastFriday.getDate();
		var lastMonth_end = getWeekNumber(lastFridayYear, lastFridayMonth, lastFridayDate)
	} else {
		var fridayYear = lastMonth_lastFriday.getFullYear()
		var fridayMonth = lastMonth_lastFriday.getMonth() + 1
		var fridayDate = lastMonth_lastFriday.getDate()
		var lastMonth_end = getWeekNumber(fridayYear, fridayMonth, fridayDate)
	}

	return { "nowMonthYear": nowYear, "nowMonth": nowMonth, "nowStart": nowMonth_begin, "nowEnd": nowMonth_end, "lastMonthYear": lastYear, "lastMonth": lastMonth, "lastStart": lastMonth_begin, "lastEnd": lastMonth_end }
}

//从url中截取传递到数据
function getUrlItem(name) { //id
	var url = location.search
	start = url.indexOf(name + "=")
	if(start != -1) {
		start = start + name.length + 1
		end = url.indexOf("&", start)
		if(end == -1) {
			end = url.length
			return unescape(url.substring(start, end))
		}
		return unescape(url.substring(start, end))
	}
	return '';
}

//分项趋势折线图函数
/**
 * 
 * @param {Object} a 传入vue对象
 * @param {string} b 存放图标的div的id
 * @param {string} c 查询的分项条件
 * @param {string} d 调用的接口名
 */
function loadTongBi(a, b, c, d) {
	var x = []; //X轴
	var y = []; //Y轴
	var xtext = []; //X轴TEXT 
	$.ajax({
		type: 'get',
		url: 'http://47.92.116.158:8099/BhGgjAPI/Chartdata.asmx/' + d + '?callback=?', //请求数据的地址
		data: {
			type: c,
			jsondata: a.dataRange
		},
		dataType: "json",
		success: function(data) {
			var json = data
			var s = 1;
			//循环整理表格所要的数据格式
			for(var item in json) {
				for(var key in json[item]) {
					json[item][key].y = parseFloat(json[item][key].NUM); //给Y轴赋值 浮点型
					xtext[key] = json[item][key].MONTH + "月"; //给X轴TEXT赋值
				}
			}
			//以下是百分比的计算方式
			//将另一年的对比值赋值到当前数组
			for(var i = 0; i < json.lastYear.length; i++) {
				json.lastYear[i].nowNum = json.nowYear[i].y
				json.lastYear[i].lastNum = json.lastYear[i].y

			}

			for(var i = 0; i < json.nowYear.length; i++) {
				json.nowYear[i].nowNum = json.nowYear[i].y
				json.nowYear[i].lastNum = json.lastYear[i].y
			}

			for(var item in json) {
				for(var key in json[item]) {
					if(json[item][key].nowNum > json[item][key].lastNum) {
						json[item][key].tips = "增长"
					} else {
						json[item][key].tips = "降低"
					}
					if(json[item][key].lastNum == 0) {
						json[item][key].per = 100;
					} else {
						json[item][key].per = parseInt(Math.abs(json[item][key].nowNum - json[item][key].lastNum) / json[item][key].lastNum * 100)
					}
					json[item][key].cYear = a.selectYear.toString().substring(2, 5)
					json[item][key].lYear = a.lastYear.toString().substring(2, 5)
				}
			}
			chart.series[0].setData(json.lastYear); //数据填充到highcharts上面
			chart.series[1].setData(json.nowYear); //数据填充到highcharts上面
			a.index++
		},
		error: function(e) {

		}
	});
	var chart = new Highcharts.Chart({
		colors: ['#01a0e8', '#fa4a54', '#2aac20', '#ff9333'], //绘图线颜色
		chart: {
			renderTo: b,
			type: 'line' //显示类型 折线
		},
		title: {
			text: '' //图表的标题
		},
		//当鼠标经过时的提示设置
		tooltip: {
			headerFormat: '<span style="font-size:11px"><b>{series.name}年<b></span><br>',
			pointFormat: '<span style="color:{point.color}">{point.MONTH}月</span>：{point.y}<br/><span style="color:blue;">{point.cYear}年比{point.lYear}年同期：</span>{point.tips}{point.per}%<br/>'
		},
		xAxis: {
			categories: xtext
		},
		yAxis: {
			title: {
				text: '', //Y轴的名称
				style: {
					color: '#333333',
					fontWeight: 'bold',
					fontSize: '14px'
				}
			}
		},
		series: [{
			name: a.lastYear
			//data: [7.0, 6.9, 9.5, 14.5, 18.4]
		}, {
			name: a.selectYear
		}],
		plotOptions: { //plotOptions全局设置
			line: {
				dataLabels: {
					enabled: true // 开启数据标签
				},
			},
			series: { //对series的全局设置                        
				cursor: 'pointer',
				marker: {
					symbol: 'diamond' //节点的形状曲线点类型："circle", "square", "diamond", "triangle","triangle-down"，默认是"circle"
				},
				dataLabels: {
					enabled: true, //是否在节点上显示数据
					color: '#333',
					align: 'center',
					style: { fontSize: '13px' }
				}
			}
		},
		credits: {
			enabled: false //隐藏右下角网址
		},
		exporting: {
			enabled: false //隐藏右上角打印
		}
	});

}

//主要业务环比图函数
/**
 * 
 * @param {Object} 传入的vue对象
 * @param {string} 存放环比图的div的id
 * @param {string} 调用的接口名
 */

function loadHuanBi(a, b, c) {
	var x = []; //X轴
	var y = []; //Y轴
	var xtext = []; //X轴TEXT
	var colorOne = ["#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd", "#4f81bd"];
	var color = ["#c0504d", "#c0504d", "#c0504d", "#c0504d", "#c0504d", "#c0504d", "#c0504d", "#c0504d", "#c0504d"];
	$.ajax({
		type: 'post',
		url: 'http://47.92.116.158:8099/BhGgjAPI/Chartdata.asmx/' + c + '?callback=?', //请求数据的地址
		data: {
			"year1": a.huanBiData.nowMonthYear,
			"week1": a.huanBiData.nowStart,
			"year2": a.huanBiData.nowMonthYear,
			"week2": a.huanBiData.nowEnd,
			"year_last1": a.huanBiData.lastMonthYear,
			"week_last1": a.huanBiData.lastStart,
			"year_last2": a.huanBiData.lastMonthYear,
			"week_last2": a.huanBiData.lastEnd
		},
		dataType: "json",
		success: function(data) {
			//var json = eval("(" + data + ")");
			var json = data;
			var s = 1;

			//当前月
			for(var key in json.currentMonth) {
				json.currentMonth[key].y = parseFloat(json.currentMonth[key].NUM); //给Y轴赋值
				xtext[key] = json.currentMonth[key].TITLE; //给X轴TEXT赋值
				json.currentMonth[key].color = colorOne[key];
			}
			chart.series[0].setData(json.currentMonth); //数据填充到highcharts上面

			//上个月
			for(var key in json.lastMonth) {
				json.lastMonth[key].y = parseFloat(json.lastMonth[key].NUM); //给Y轴赋值
				xtext[key] = json.lastMonth[key].TITLE; //给X轴TEXT赋值     
				json.lastMonth[key].color = color[key];
			}
			chart.series[1].setData(json.lastMonth); //数据填充到highcharts上面
			a.index++
		},
		error: function(e) {

		}
	});
	var chart = new Highcharts.Chart({
		//color: ["#d7d7d7", "#3992fd", "#f9873a", "#cc33cc"],
		chart: {
			renderTo: b,
			type: 'column' //显示类型 柱形
		},
		title: {
			text: '' //图表的标题
		},
		//当鼠标经过时的提示设置
		tooltip: {
			headerFormat: '<span style="font-size:11px"><b>{series.name}<b></span><br>',
			pointFormat: '<span style="color:{point.color}">{point.TITLE}</span>：<b>{point.y}</b><br/>'
		},
		xAxis: {
			categories: xtext
		},
		yAxis: {
			title: {
				text: '', //Y轴的名称
				style: {
					color: '#333333',
					fontWeight: 'bold',
					fontSize: '14px'
				}
			}
		},
		series: [{
			name: "本月（" + a.huanBiData.nowMonth + "月）",
			color: '#4f81bd'
		}, {
			name: "上月（" + a.huanBiData.lastMonth + "月）",
			color: '#c0504d'
		}],
		plotOptions: { //plotOptions全局设置
			series: { //对series的全局设置                        
				cursor: 'pointer',
				dataLabels: {
					enabled: true, //是否在节点上显示数据
					color: '#333',
					align: 'center',
					style: { fontSize: '13px' }
				}
			}
		},
		credits: {
			enabled: false //隐藏右下角网址
		},
		exporting: {
			enabled: false //隐藏右上角打印
		}
	});
};